package org.icop.virtdoc;

import java.util.List;
import java.util.Map;

public class VirtualDocUtil {
	
	public static void addToTermsCount(Map<String,Double> termsCount, String term, Double count) {
		double c = 0;
		if (termsCount.containsKey(term))
			c = termsCount.get(term);
		termsCount.put(term, c+count);
	}
	
	public static void addToTermsCount(Map<String,Double> termsCount, List<String> terms) {
		for (String t : terms)
			addToTermsCount(termsCount,t,1d);
	}
	
	public static void addToTermsCount(Map<String,Double> termsCount, Map<String,Double> tmpTermsCount) {
		for (String t : tmpTermsCount.keySet())
			addToTermsCount(termsCount,t,tmpTermsCount.get(t));
	}

}
